package service

import (
	"gin-easy/models"
	"gin-easy/pkg/rabbitmq"
)

type Article struct {
	Title   string
	Content string
}

/*
*
添加文章
*/
func (a *Article) ArticleAdd() bool {
	articlr := map[string]interface{}{
		"title":   a.Title,
		"content": a.Content,
	}
	//mysql
	models.ArticleCreate(articlr)
	//rabbitmq
	rabbitmq.Send(rabbitmq.ARTICLE, articlr, rabbitmq.TASK_ARTICLE)
	return true
}
